<!DOCTYPE html>
<html lang="zh-Hans-CN">
<head>
    <meta charset="UTF-8">
    <title>事件监听：v-on:事件名='js脚本|事件方法名'</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="../vue.js"></script>
</head>
<body>
<h2>【例18】事件监听：v-on:事件名='js脚本|事件方法名'</h2>
<hr>
<div id="app">
    <button v-on:click="js=he;bjs=Math.floor(Math.random()*10);he=js+bjs;">加上1个随机10以内整数</button>
    <p>{{js}} + {{bjs}} = {{he}}</p>
</div>
<script>
    let vm = new Vue({
        el: '#app',
        data: {
            js: 0,
            bjs: 0,
            he: 0
        }
    })
</script>
<hr>
<p><a href="index.html">返回章节目录</a>
    <script>document.write(document.lastModified); </script>
</p>
</body>
</html>
